package com.yulang.security.provider;

import com.yulang.security.properties.CustomSpringSecurityProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
import org.springframework.stereotype.Component;

@Component
@Order(Integer.MAX_VALUE)
public class CustomConfigureProvider implements AuthConfigProvider{

    @Autowired
    private CustomSpringSecurityProperties customSpringSecurityProperties;

    @Override
    public void configure(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry config) {
        config.antMatchers(customSpringSecurityProperties.getAuth().getWhiteUrl()).permitAll();
        config.anyRequest().authenticated();
    }
}
